package com.tz.entity;
import java.util.Date;

import javax.persistence.*;

@Entity
@Table(name="TBL_ORDER")
public class Order {

	private long id;

	private User user;

	private Date createDate;

	private double totalPrice;

	private String status;

	private double shipping;

	private String vouchersCode;

	public Order() {
		
	}

	public Order(User user, Date createDate, double totalPrice, String status,
			double shipping, String vouchersCode) {
		super();
		this.user = user;
		this.createDate = createDate;
		this.totalPrice = totalPrice;
		this.status = status;
		this.shipping = shipping;
		this.vouchersCode = vouchersCode;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO,generator="s2")
	@SequenceGenerator(name="s2",sequenceName="tbl_order_id")
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name="o_createDate")
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name="o_totalPrice")
	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	@Column(name="o_status")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name="o_shipping")
	public double getShipping() {
		return shipping;
	}

	public void setShipping(double shipping) {
		this.shipping = shipping;
	}

	@Column(name="o_vouchersCode")
	public String getVouchersCode() {
		return vouchersCode;
	}

	public void setVouchersCode(String vouchersCode) {
		this.vouchersCode = vouchersCode;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Order [id=");
		builder.append(id);
		builder.append(", user=");
		builder.append(user);
		builder.append(", createDate=");
		builder.append(createDate);
		builder.append(", totalPrice=");
		builder.append(totalPrice);
		builder.append(", status=");
		builder.append(status);
		builder.append(", shipping=");
		builder.append(shipping);
		builder.append(", vouchersCode=");
		builder.append(vouchersCode);
		builder.append("]");
		return builder.toString();
	}
	
}
